const whiteList = [
	'/pages/my/my'
]
function hasPermission (url) {
	let islogin = sessionStorage.getItem("token");
	islogin = Boolean(Number(islogin));//返回布尔值
    if(whiteList.indexOf(url) !== -1 || islogin) {
        return true
    }
    return false
}
uni.addInterceptor('navigateTo', {
    invoke (e) {
        if(!hasPermission(e.url)){
            uni.reLaunch({
                url: '/pages/my/my'
            })
            return false
        }
        return true
    },
    success (e) {
    }
})
 
uni.addInterceptor('switchTab', {
    // tabbar页面跳转前进行拦截
    invoke (e) {
        if(!hasPermission(e.url)){
            uni.reLaunch({
                url: '/pages/my/my'
            })
            return false
        }
        return true
    },
    success (e) {
    }
})